#define HEADHEIGHT 70
#define TOOLHEIGHT (66.0 + GK_SAVEAREA_BTM)
#define PROGRESSHEIGHT 28
#import "CampustDetailFooterView.h"
#import "ZFSliderView.h"
#import "CampusSchoolVideoItemModel.h"
typedef void(^doneBlock)(kXHFooterType type);

@interface CampustDetailFooterView ()<ZFSliderViewDelegate>
@property (nonatomic,strong)UIView *headView;
@property (nonatomic,strong)UIView *toolView;
@property (nonatomic,strong)UIView *progressView;
@property (nonatomic,strong)UIView *contentView;
@property (nonatomic,strong)UILabel *contentLb;
@property (nonatomic,strong)UIImageView *headerIcon;

@property (nonatomic,strong)UILabel *dissCount;
@property (nonatomic,strong)UILabel *likeCount;
@property (nonatomic,strong)UILabel *shareCount;

@property (nonatomic,strong)UIImageView *dissIcon;
@property (nonatomic,strong)UIImageView *likeIcon;
@property (nonatomic,strong)UIImageView *shareIcon;

@property (nonatomic,strong)UILabel *nameLb;
@property (nonatomic,strong)UILabel *allLb;
@property (nonatomic,strong)UILabel *closeLb;
@property (nonatomic,strong)UITextView *textView;
@property (nonatomic,assign)BOOL isShow;

@property (nonatomic,strong)CAGradientLayer *gradientLayer;


@property (nonatomic,copy)doneBlock done;

@property (nonatomic,strong)CampusSchoolVideoItemModel *currentModel;

@property (nonatomic,strong)ZFSliderView *progress;

@property (nonatomic,weak)id<CampustDetailFooterViewDelegate>delegate;

@property (nonatomic,assign)CGFloat progressHeight;

@property (nonatomic,strong)UIButton *shareBtn;
@property (nonatomic,strong)UIButton *dissBtn;
@property (nonatomic,strong)UIButton *likeBtn;


@end

@implementation CampustDetailFooterView




- (instancetype)initWithCompleteBlock:(void (^)(kXHFooterType type))completeBlock{
    if (self = [super init]) {
        [self setUI];
        
        if (completeBlock) {
            self.done = ^(kXHFooterType type) {
                completeBlock(type);
            };
        }
    }
    return self;
}

- (void)setUI{
    CGSize size = [RPAppManager getTextSizeWithText:@"高考可能是一个人一生中最为难忘的记忆之一" font:font(14) maxSize:CGSizeMake(kScreenW - 16 - 60, MAXFRAG)];
    
    self.frame = CGRectMake(0,kScreenH, kScreenW, TOOLHEIGHT + HEADHEIGHT + PROGRESSHEIGHT + ceil(size.height) * 2);
    
    self.headView = [[UIView alloc]init];
    [self addSubview:self.headView];
    
    self.toolView = [[UIView alloc]init];
    [self addSubview:self.toolView];
    
    self.contentView = [[UIView alloc]init];
    [self addSubview:self.contentView];
    
    
    self.progressView = [[UIView alloc]init];
    [self addSubview:self.progressView];
        
    [self.progressView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self.toolView.mas_top);
        make.left.right.equalTo(self);
        make.height.mas_equalTo(PROGRESSHEIGHT);
    }];
    
    [self.contentView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self.progressView.mas_top);
        make.left.right.equalTo(self);
        make.height.mas_equalTo(ceil(size.height) * 2);
    }];
    

    [self.headView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.equalTo(self);
        make.bottom.equalTo(self.contentView.mas_top);
        make.height.mas_equalTo(HEADHEIGHT);
    }];
    
    [self.toolView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.equalTo(self);
        make.bottom.equalTo(self);
        make.height.mas_equalTo(TOOLHEIGHT);
    }];
    
    self.contentLb = [[UILabel alloc]init];
    self.contentLb.text = @"高考可能是一个人一生中最为难忘的记忆之一";
    self.contentLb.textColor = [UIColor whiteColor];
    self.contentLb.font = font(14);
    self.contentLb.numberOfLines = 2;
    [self.contentView addSubview:self.contentLb];
    
    self.headerIcon = [[UIImageView alloc]init];
    self.headerIcon.layer.cornerRadius = 19;
    self.headerIcon.layer.masksToBounds = YES;
    self.headerIcon.image = [UIImage imageNamed:@"defaut_header"];
    [self.headView addSubview:self.headerIcon];

    
    self.textView = [[UITextView alloc]init];
    self.textView.font = font(14);
    self.textView.textColor = [UIColor whiteColor];
    self.textView.backgroundColor = [UIColor clearColor];
    self.textView.showsVerticalScrollIndicator = NO;
    self.textView.showsHorizontalScrollIndicator = NO;
    self.textView.textContainerInset = UIEdgeInsetsZero;
    self.textView.textContainer.lineFragmentPadding = 0;
    self.textView.editable  = NO;
    [self.contentView addSubview:self.textView];
    [self.textView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.top.bottom.equalTo(self.contentLb);
        make.right.equalTo(self).offset(-16);
    }];
    
    self.allLb = [[UILabel alloc]init];
    self.allLb.text = @"展开";
    self.allLb.textColor = [UIColor whiteColor];
    self.allLb.font = font(14);
    self.allLb.userInteractionEnabled = YES;
    [self addSubview:self.allLb];
    [self.allLb mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self.contentLb.mas_bottom);
        make.left.equalTo(self.contentLb.mas_right);
    }];
    
    UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(tapMethod)];
    [self.allLb addGestureRecognizer:tap];
    
    [self.contentLb mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self).offset(16);
        make.right.equalTo(self).offset(-60);
        make.top.equalTo(self.contentView);
        make.height.mas_equalTo(ceil(size.height) * 2);
    }];

    

    [self.headerIcon mas_makeConstraints:^(MASConstraintMaker *make) {
        make.size.mas_equalTo(CGSizeMake(38, 38));
        make.left.equalTo(self.headView).offset(16);
        make.top.equalTo(self.headView).offset(16);
    }];
    
    
    self.likeCount = [[UILabel alloc]init];
    self.likeCount.textColor = [UIColor whiteColor];
    self.likeCount.font = font(14);
    [self.toolView addSubview:self.likeCount];

    [self.likeCount mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.toolView).offset(-GK_SAVEAREA_BTM/2);
        make.right.equalTo(self.toolView.mas_right).offset(-16);
    
    }];

    self.likeIcon = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"campus_detail_like_tag"]];
    self.likeIcon.highlightedImage = [UIImage imageNamed:@"campus_detail_selected_like_tag"];
    [self.toolView addSubview:self.likeIcon];
    [self.likeIcon mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.toolView).offset(-GK_SAVEAREA_BTM/2);
        make.right.equalTo(self.likeCount.mas_left).offset(-10);
    }];
    
    self.likeBtn = [[UIButton alloc]init];
    [self.likeBtn addTarget:self action:@selector(likeMethod) forControlEvents:UIControlEventTouchUpInside];
    [self.toolView addSubview:self.likeBtn];
    
    [self.likeBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self.likeIcon.mas_bottom).offset(5);
        make.top.equalTo(self.likeIcon.mas_top).offset(-5);
        make.left.equalTo(self.likeIcon.mas_left);
        make.right.equalTo(self.likeCount.mas_right);
    }];
    [self.likeIcon setContentHuggingPriority:UILayoutPriorityDefaultHigh forAxis:UILayoutConstraintAxisHorizontal | UILayoutConstraintAxisVertical];
    
    self.dissCount = [[UILabel alloc]init];
    self.dissCount.textColor = [UIColor whiteColor];
    self.dissCount.font = font(14);
    [self.toolView addSubview:self.dissCount];
    [self.dissCount mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.toolView).offset(-GK_SAVEAREA_BTM/2);
        make.right.equalTo(self.likeIcon.mas_left).offset(-18);
    }];

    self.dissIcon = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"campus_detail_diss_tag"]];
    self.dissIcon.highlightedImage = [UIImage imageNamed:@"campus_detail_selected_diss_tag"];
    [self.toolView addSubview:self.dissIcon];
    [self.dissIcon mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.toolView).offset(-GK_SAVEAREA_BTM/2);
        make.right.equalTo(self.dissCount.mas_left).offset(-10);
    }];
    
    self.dissBtn = [[UIButton alloc]init];
    [self.dissBtn addTarget:self action:@selector(dissMethod) forControlEvents:UIControlEventTouchUpInside];
    [self.toolView addSubview:self.dissBtn];
   
    [self.dissBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self.dissIcon.mas_bottom).offset(5);
        make.top.equalTo(self.dissIcon.mas_top).offset(-5);
        make.left.equalTo(self.dissIcon.mas_left);
        make.right.equalTo(self.dissCount.mas_right);
    }];
    [self.dissIcon setContentHuggingPriority:UILayoutPriorityDefaultHigh forAxis:UILayoutConstraintAxisHorizontal | UILayoutConstraintAxisVertical];
    
    self.shareCount = [[UILabel alloc]init];
    self.shareCount.textColor = [UIColor whiteColor];
    self.shareCount.font = font(14);
    [self.toolView addSubview:self.shareCount];

    [self.shareCount mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.toolView).offset(-GK_SAVEAREA_BTM/2);
        make.right.equalTo(self.dissIcon.mas_left).offset(-18);
    }];

    self.shareIcon = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"campus_footer_share_tag"]];
    [self.toolView addSubview:self.shareIcon];
    [self.shareIcon mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.toolView).offset(-GK_SAVEAREA_BTM/2);
        make.right.equalTo(self.shareCount.mas_left).offset(-10);
    }];
    
    self.shareBtn = [[UIButton alloc]init];
    [self.shareBtn addTarget:self action:@selector(shareMethod) forControlEvents:UIControlEventTouchUpInside];
    [self.toolView addSubview:self.shareBtn];
    [self.shareBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self.shareIcon.mas_bottom).offset(5);
        make.top.equalTo(self.shareIcon.mas_top).offset(-5);
        make.left.equalTo(self.shareIcon.mas_left);
        make.right.equalTo(self.shareCount.mas_right);
    }];
    
    [self.shareIcon setContentHuggingPriority:UILayoutPriorityDefaultHigh forAxis:UILayoutConstraintAxisHorizontal | UILayoutConstraintAxisVertical];
    
    self.nameLb = [[UILabel alloc]init];
    self.nameLb.textColor = [UIColor whiteColor];
    self.nameLb.font = [UIFont boldSystemFontOfSize:14];
    [self addSubview:self.nameLb];
    [self.nameLb mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.headerIcon.mas_right).offset(8);
        make.centerY.equalTo(self.headerIcon);
    }];
    
    self.closeLb = [[UILabel alloc]init];
    self.closeLb.text = @"收起";
    self.closeLb.textColor = [UIColor whiteColor];
    self.closeLb.textAlignment = NSTextAlignmentRight;
    self.closeLb.font = font(14);
    self.closeLb.userInteractionEnabled = YES;
    self.closeLb.hidden = YES;
    [self.progressView addSubview:self.closeLb];
    [self.closeLb mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.progressView).offset(8);
        make.right.equalTo(self.progressView).offset(-16);
        make.size.mas_equalTo(CGSizeMake(40, 20));
    }];
    
    UITapGestureRecognizer *closeTap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(closeMethod)];
    [self.closeLb addGestureRecognizer:closeTap];
    

    
    self.gradientLayer = [CAGradientLayer layer];
    self.gradientLayer.frame = self.bounds;
    self.gradientLayer.colors = [NSArray arrayWithObjects:
    (id)[RGBA(0, 0, 0, 0) CGColor],
    (id)[RGBA(0, 0, 0, 0.7) CGColor],nil];
    self.gradientLayer.startPoint = CGPointMake(0, 0);
    self.gradientLayer.endPoint = CGPointMake(0, 1);
    [self.layer insertSublayer:self.gradientLayer atIndex:0];
   
    self.progress = [[ZFSliderView alloc]init];
    self.progress.sliderHeight = 1;
    self.progress.delegate = self;
    [self.progress startForward];
    [self.progressView addSubview:self.progress];
    
    self.progress.minimumTrackTintColor = [UIColor whiteColor];
    self.progress.maximumTrackTintColor = C102;
    
    [self.progress mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.top.equalTo(self.progressView);
        make.left.equalTo(self.progressView).offset(16);
        make.right.equalTo(self.progressView).offset(-16);
    }];
    
}

- (void)showInView:(UIView *)mainView delegate:(nonnull id<CampustDetailFooterViewDelegate>)delegate{
    self.delegate = delegate;
    [mainView addSubview:self];
}

- (void)likeMethod{
    
    if ([RPAppManager isShowNetworkView]) {
        [WHToast showErrorWithMessage:@"网络好像有点问题，请检查后重试" duration:2 finishHandler:nil];
        return;
    }
    if (![RPAppManager isLogin]) {
        self.done(kXHCampusFooterLike);
        return;
    }
    self.currentModel.isLike = !self.currentModel.isLike;
    self.likeIcon.highlighted = self.currentModel.isLike;
    NSInteger max = self.currentModel.likeNum.intValue +  (self.currentModel.isLike?1:-1);
    if (max >= 10000) {
        NSInteger count = max;
        if (count % 1000 == 0) {
            count += 1;
        }
        self.likeCount.text = [NSString stringWithFormat:@"%@w",[RPAppManager notRounding:count/10000.0f afterPoint:1]];
    }else{
        self.likeCount.text = [NSString stringWithFormat:@"%ld",(long)max];
    }
    self.currentModel.likeNum = @(max);
    self.done(kXHCampusFooterLike);
}
- (void)dissMethod{
    if ([RPAppManager isShowNetworkView]) {
        [WHToast showErrorWithMessage:@"网络好像有点问题，请检查后重试" duration:2 finishHandler:nil];
        return;
    }
    if (![RPAppManager isLogin]) {
        self.done(kXHCampusFooterDiss);
        return;
    }
    self.currentModel.isUnLike = !self.currentModel.isUnLike;
    self.dissIcon.highlighted = self.currentModel.isUnLike;
    NSInteger max = self.currentModel.unLikeNum.intValue + (self.currentModel.isUnLike?1:-1);
    if (max >= 10000) {
        NSInteger count = max;
        if (count % 1000 == 0) {
            count += 1;
        }
        self.dissCount.text = [NSString stringWithFormat:@"%@w",[RPAppManager notRounding:count/10000.0f afterPoint:1]];
    }else{
        self.dissCount.text = [NSString stringWithFormat:@"%ld",(long)max];
    }
    self.currentModel.unLikeNum = @(max);
    self.done(kXHCampusFooterDiss);
}



- (void)closeMethod{
    [self showNormalWithAnimate:YES];
}


- (void)shareMethod{
    self.done(kXhCampusFooterShare);
}

- (void)tapMethod{
    [self showAllWithAnimate:YES];
}

- (CGFloat)heightOfLines:(int)lines font:(UIFont *)font{
    if (lines <= 0) {
        return 0;
    }
    NSString *str = @"*";
    for (int index = 0; index < lines - 1 ; index++) {
        str = [str stringByAppendingString:@"\n*"];
    }
    NSDictionary *dict = @{NSFontAttributeName:font};
    
    CGSize size = [str sizeWithAttributes:dict];
    
    return ceil(size.height);
}

- (void)setProgressValue:(CGFloat)progressValue{
   
    _progressValue = progressValue;
    
    self.progress.value = progressValue;
}



- (void)setItemModel:(CampusSchoolVideoItemModel *)itemModel{
 
    self.currentModel = itemModel;
    
    self.contentLb.text = itemModel.title;
    
    CGFloat maxH = [self heightOfLines:2 font:font(14)];
    
    CGSize size = [RPAppManager getTextSizeWithText:self.contentLb.text font:font(14) maxSize:CGSizeMake(kScreenW - 16 - 60, MAXFLOAT)];
   
    if (maxH >= ceil(size.height)) {
        self.allLb.text = @"";
    }else{
        self.allLb.text = @"展开";
    }

    
    [self showNormalWithAnimate:NO];
    
    self.shareCount.text = itemModel.shareNum.stringValue;
    self.dissCount.text = itemModel.unLikeNum.stringValue;
    self.likeCount.text = itemModel.likeNum.stringValue;
    
    if (itemModel.likeNum.intValue >= 10000) {
        NSInteger count = itemModel.likeNum.intValue;
        if (count % 1000 == 0) {
            count += 1;
        }
        self.likeCount.text = [NSString stringWithFormat:@"%@w",[RPAppManager notRounding:count/10000.0f afterPoint:1]];
    }else{
        self.likeCount.text = [NSString stringWithFormat:@"%d",itemModel.likeNum.intValue];
    }
    
    if (itemModel.unLikeNum.intValue >= 10000) {
        NSInteger count = itemModel.unLikeNum.intValue;
        if (count % 1000 == 0) {
            count += 1;
        }
        self.dissCount.text = [NSString stringWithFormat:@"%@w",[RPAppManager notRounding:count/10000.0f afterPoint:1]];
    }else{
        self.dissCount.text = [NSString stringWithFormat:@"%d",itemModel.unLikeNum.intValue];
    }
    
    if (itemModel.shareNum.intValue >= 10000) {
        NSInteger count = itemModel.shareNum.intValue;
        if (count % 1000 == 0) {
            count += 1;
        }
        self.shareCount.text = [NSString stringWithFormat:@"%@w",[RPAppManager notRounding:count/10000.0f afterPoint:1]];
    }else{
        self.shareCount.text = [NSString stringWithFormat:@"%d",itemModel.shareNum.intValue];
    }

    
    self.likeIcon.highlighted = itemModel.isLike;
    self.dissIcon.highlighted = itemModel.isUnLike;

    
   
    self.headerIcon.hidden = YES;
    self.nameLb.hidden = YES;
    
    UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(dismissView)];
    [self addGestureRecognizer:tap];
}
- (void)dismissView{
    [self showNormalWithAnimate:YES];
}


- (void)showAllWithAnimate:(BOOL)animate{
    
    self.progressHeight = 50;
    self.gradientLayer.hidden = YES;
    self.isShow = YES;
    CGSize size = [RPAppManager getTextSizeWithText:self.contentLb.text font:font(14) maxSize:CGSizeMake(kScreenW - 32, MAXFLOAT)];
    self.contentLb.hidden = YES;
    self.allLb.hidden = YES;
    self.closeLb.hidden = NO;
    self.textView.hidden = NO;
    self.textView.text = self.contentLb.text;
    
    self.backgroundColor = RGBA(0, 0, 0, 0.7);
    
    self.cl_y = 0;
    
    self.cl_height = kScreenH;
    
    [self layoutIfNeeded];
    
    CGFloat textH = MIN(ceil(size.height), kScreenH - kNavBarHeight - 64 - 200);
    if (animate) {
        [UIView animateWithDuration:0.25 animations:^{
            [self.contentView mas_updateConstraints:^(MASConstraintMaker *make) {
                make.height.mas_equalTo(textH);
            }];
            [self.contentLb mas_updateConstraints:^(MASConstraintMaker *make) {
                make.height.mas_equalTo(textH);
            }];
            [self.progressView mas_updateConstraints:^(MASConstraintMaker *make) {
                make.height.mas_equalTo(self.progressHeight);
            }];
            [self.progress mas_updateConstraints:^(MASConstraintMaker *make) {
                make.top.equalTo(self.progressView).offset(28.0f);
            }];
            

            [self layoutIfNeeded];
            
        } completion:^(BOOL finished) {
        }];
    }else{
        [self.contentView mas_updateConstraints:^(MASConstraintMaker *make) {
            make.height.mas_equalTo(textH);
        }];
        [self.contentLb mas_updateConstraints:^(MASConstraintMaker *make) {
            make.height.mas_equalTo(textH);
        }];
        [self.progressView mas_updateConstraints:^(MASConstraintMaker *make) {
            make.height.mas_equalTo(self.progressHeight);
        }];
        [self.progress mas_updateConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self.progressView).offset(28.0f);
        }];
    
    }
    
}

- (void)showNormalWithAnimate:(BOOL)animate{
    
    self.isShow = NO;
   
    self.gradientLayer.hidden = NO;
    
    self.closeLb.hidden = YES;
    
    self.progressHeight = PROGRESSHEIGHT;
  
    CGSize size = [RPAppManager getTextSizeWithText:self.contentLb.text font:font(14) maxSize:CGSizeMake(kScreenW - 60 - 16, MAXFRAG)];
    
    CGFloat textH = self.contentLb.text.length == 0?0:ceil(size.height) * 2;
    
    NSMutableArray *subViews = [[UIApplication sharedApplication].keyWindow.subviews mutableCopy];
  
    [subViews removeObject:self];
    
    self.backgroundColor = [UIColor clearColor];
    

    if (animate) {
        [UIView animateWithDuration:0.25 animations:^{
            [self.contentView mas_updateConstraints:^(MASConstraintMaker *make) {
                make.height.mas_equalTo(textH);
            }];
            [self.contentLb mas_updateConstraints:^(MASConstraintMaker *make) {
                make.height.mas_equalTo(textH);
            }];
            [self.progressView mas_updateConstraints:^(MASConstraintMaker *make) {
                make.height.mas_equalTo(self.progressHeight);
            }];
            [self.progress mas_updateConstraints:^(MASConstraintMaker *make) {
                make.top.equalTo(self.progressView);
            }];
            self.cl_y = kScreenH - (HEADHEIGHT + TOOLHEIGHT + textH + self.progressHeight);
            self.cl_height = HEADHEIGHT + TOOLHEIGHT + textH + self.progressHeight;
            
       
            [self layoutIfNeeded];
        } completion:^(BOOL finished) {
            if (finished) {
                self.textView.editable = NO;
                self.textView.hidden = YES;
                self.contentLb.hidden = NO;
                self.allLb.hidden = NO;
                self.textView.text = @"";

                self.headView.backgroundColor = [UIColor clearColor];
                self.contentView.backgroundColor = [UIColor clearColor];
                self.toolView.backgroundColor =[UIColor clearColor];
                self.progressView.backgroundColor = [UIColor clearColor];
                
            }
        }];
    }else{
        [self.contentView mas_updateConstraints:^(MASConstraintMaker *make) {
            make.height.mas_equalTo(textH);
        }];
        [self.contentLb mas_updateConstraints:^(MASConstraintMaker *make) {
            make.height.mas_equalTo(textH);
        }];
        [self.progressView mas_updateConstraints:^(MASConstraintMaker *make) {
            make.height.mas_equalTo(self.progressHeight);
        }];
        [self.progress mas_updateConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self.progressView);
        }];
        self.cl_y = kScreenH - (HEADHEIGHT + TOOLHEIGHT + textH + self.progressHeight);
        self.cl_height = HEADHEIGHT + TOOLHEIGHT + textH + self.progressHeight;

        self.textView.hidden = YES;
        self.textView.editable = NO;
        self.contentLb.hidden = NO;
        self.allLb.hidden = NO;
        self.textView.text = @"";
    }

    
}

#pragma mark - ZFSliderViewDelegate
// 滑杆点击
- (void)sliderTapped:(float)value{
    NSLog(@"滑动点击：%f",value);
    if (self.delegate && [self.delegate respondsToSelector:@selector(updateVideoProgressValue:)]) {
        [self.delegate updateVideoProgressValue:value];
    }
}
// 滑块滑动开始
- (void)sliderTouchBegan:(float)value{
    NSLog(@"滑动开始：%f",value);
    if (self.delegate && [self.delegate respondsToSelector:@selector(progressBeginDraging)]) {
        [self.delegate progressBeginDraging];
    }
    
}
// 滑块滑动中
- (void)sliderValueChanged:(float)value{
    if (self.delegate && [self.delegate respondsToSelector:@selector(changeVideoProgressValue:)]) {
        [self.delegate changeVideoProgressValue:value];
    }
    
}
// 滑块滑动结束
- (void)sliderTouchEnded:(float)value{
    self.progress.isdragging = YES;

    if (self.delegate && [self.delegate respondsToSelector:@selector(updateVideoProgressValue:)]) {
        [self.delegate updateVideoProgressValue:value];
    }
    

}





@end
